#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <stack>
#include <cstring>
#include <queue>
#include <cctype>
#include <iomanip>
#include <climits>
#include <array>
#include <cmath>

using i64 = signed long long int;

constexpr int N = 555;

bool st[N];
int match[N];

std::vector<int> adj[N];

bool find(int x) {
    for (auto v : adj[x]) {
        if (!st[v]) {
            st[v] = true;
            if (match[v] == 0 || find(match[v])) {
                match[v] = x;
                return true;
            }
        }
    }
    return false;
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n, m, e;
    std::cin >> n >> m >> e;

    for (int i = 0; i < e; ++i) {
        int u, v;
        std::cin >> u >> v;
        adj[u].push_back(v);
    }

    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        std::memset(st, 0, sizeof st);
        if (find(i)) {
            ++cnt;
        }
    }

    std::cout << cnt;

    return 0;
}